package com.usain.filters;

import com.alibaba.fastjson.JSON;
import org.springframework.core.annotation.Order;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

@Order(1)
@WebFilter(filterName = "AdminTokenFilter"+"/*")
public class AdminTokenFilter extends GenericFilter {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse res, FilterChain filterChain) throws IOException, ServletException {
        //过滤器调用链子

        System.out.println("进入");
        filterChain.doFilter(servletRequest,res);
       /* res.setCharacterEncoding("utf-8");
      res.setContentType("application/json");
       Map map = new HashMap();
       map.put("code","123456");
       res.getOutputStream().write(JSON.toJSONString(map).getBytes());*/
    }
}
